package disPatcher; /**
 * @author： pang-yun
 * @date： 2021-11-26 17:45
 * 功能目的 ：用于
 */


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.io.PrintWriter;

public class disPatcher extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("第二次转发进去！");

//        // 设置 服务器 字符集 为 utf-8
//        response.setCharacterEncoding("UTF-8");
//        // 设置响应头 设置浏览器 也使用 utf-8 字符串
//        response.setHeader("Content-Type","text/html: charset=UTF-8");

        // 一行设置 服务器和浏览器都是用 utf-8   此方法一定要在获取 流对象之前使用才有效
        response.setContentType("text/html;charset=UTF-8");


        System.out.println(response.getCharacterEncoding());
        PrintWriter writer = response.getWriter();
        writer.write("this is response!!!");
        writer.write("庞朝杰");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
